﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace NokiaMapReCode
{
    public partial class ChoosingPlaces : PhoneApplicationPage
    {
        public ChoosingPlaces()
        {
            InitializeComponent();
        }
        private void Menu_Loaded(object sender, RoutedEventArgs e)
        {
            ListBox listBox = (sender as ListBox);
            listBox.SelectedIndex = -1;

        }

        private void Menu_selectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string landmarkName = "";
            ListBox listBox = (sender as ListBox);
            int selected = listBox.SelectedIndex;
            if (selected != -1)
            {
                listBox.SelectedIndex = -1;
                switch (selected)
                {
                    case 0:
                        landmarkName = "shopping";
                        break;
                    case 1:
                        landmarkName = "ATM";
                        break;
                    default:
                        break;
                }
                // Chuyen du lieu trang nay sang trang ban do mang theo LandMarkName
                // Khi selected cái listbox sẽ chuyển sang trang MainPage nơi mà nó có chứa bản đồ và mang theo tham số là đối tượng landmark
                NavigationService.Navigate(new Uri("/MainPage.xaml?msg=" + landmarkName, UriKind.Relative));
            }
        }
    }
}